var Version = {
	update:function (type) {
		// if (uexWidgetOne.platformName == "android") {
		if (uexWidgetOne.platformName != 'Simulator') {
			var data = {
				versionCode: constant.version
			}
			$.ajax({
				url: server_path + "/app/app_operation/varsion.do",
				headers:{
                    'lclmKey': LCLMKEY(),
                },
				data: JSON.stringify(data),
				type: "POST",
				success: function(res) {
					var newVersion = res.result.results;
					if (newVersion) {
						if (uexWidgetOne.platformName == "android") {
							appcan.window.confirm({
				                title:'提示',
				                content:"发现新版本，是否更新？\n版本号：v" + newVersion.versionCode,
				                buttons:['确定','取消'],
				                callback:function(err,data,dataType,optId){
				                    if(err){
				                        //如果出错了
				                        return;
				                    }
				                    if(data == 0){
				                        $("body").append('<div style="position:absolute; top:0px; left:0px; width:100%; height:100%; z-index:9999;"></div>');
										Download.download(newVersion.fileUrl, "down/lclm.apk", function(){
			                        		uexWidget.installApp("wgt://data/down/lclm.apk");
										}, false);
										
				                    }else if(data ==1){
				                    	
				                    }
				                }
				            });	
						} else {
							appcan.window.confirm({
				                title:'提示',
				                content:"发现新版本，请去App Store更新",
				                buttons:['确定'],
				                callback:function(err,data,dataType,optId){
				                }
				            });	
						}
					} else if (type) {
						toast('已经是最新版本了',2000,'middle',0);
					}
				}, 
                error: function(XMLHttpRequest, textStatus) {
                }
			});
		}
	}
}